#include<iostream>
using namespace std;

const int kMaxAn = (int)1e6 + 10;
int max_money[kMaxAn] = {0};
int f[kMaxAn] = {0};
int ans[kMaxAn] = {0};

int main(){
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    
    int n, q, a;
    for(cin >> n >> q; n; n--){
        cin >> a;
        max_money[a] = a;
    }
    for(int i = 1; i <= a; i++){
        if(max_money[i] == 0){
            max_money[i] = max_money[i - 1];
        }
    }
    
    int max_fi = 0;
    f[0] = 0;
    ans[f[0]] = 1;
    for(int i = 1; i < a; i++){
        f[i] = f[i % max_money[i]] + i / max_money[i];
        ans[f[i]]++;
        max_fi = max(max_fi, f[i]);
    }
    for(int i = 1; i <= max_fi; i++){
        ans[i] += ans[i-1];
    }
    for(; q; q--){
        int m;
        
        cin >> m;
        m = min(m, max_fi);
        cout << ans[m] << ' ';
    }
    cout << endl;
    return 0;
}
